import {ITile} from "../Levels";
import Singleton from "../Base/Singleton";
import {resources, SpriteFrame } from "cc";

export default class ResourceManager extends Singleton{

    static get Instance() {
        return super.GetInstance<ResourceManager>();
    }

    loadDir(path: string, type = SpriteFrame) {
        return new Promise<SpriteFrame[]>((res, rej)=>{
            resources.loadDir(path, type, function(err, assets) {
                if(err) {
                    rej(err);
                    return;
                }
                res(assets);
            })
        });
    }

}
